
package com.jf.cloud.supplier.mapper;

import com.jf.cloud.supplier.model.SupplierWalletZone;
import com.jf.cloud.supplier.vo.SupplierWalletVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 
 * @author DOG
 */
public interface SupplierWalletZoneMapper {

    /**
     * 更新
     * @param supplierWalletZone 
     */
    void update(@Param("supplierWalletZone") SupplierWalletZone supplierWalletZone);

    /**
     * 批量保存
     * @param supplierWalletZoneList
     */
    void batchSave(@Param("supplierWalletZoneList") List<SupplierWalletZone> supplierWalletZoneList);

    /**
     * 批量更新
     * @param supplierWalletZoneList
     */
    void batchUpdate(@Param("supplierWalletZoneList") List<SupplierWalletZone> supplierWalletZoneList);

    /**
     * 给供应商钱包，添加未结算金额
     *
     * @param supplierId
     * @param changeAmount
     * @param zoneNo
     * @return
     */
    int addUnsettledAmount(@Param("supplierId") Long supplierId, @Param("changeAmount") Long changeAmount, @Param("zoneNo") Integer zoneNo);

    /**
     * 给供应商钱包，减少结算金额
     * @param supplierId
     * @param changeAmount
     * @param zoneNo
     * @return
     */
    int subSettledAmount(@Param("supplierId") Long supplierId, @Param("changeAmount") Long changeAmount, @Param("zoneNo") Integer zoneNo);

    /**
     * 锁定未结算金额
     * @param supplierId
     * @param shopRealRefundAmount
     * @param zoneNo
     * @return
     */
    int subUnsettledAmount(@Param("supplierId") Long supplierId, @Param("shopRealRefundAmount") Long shopRealRefundAmount, @Param("zoneNo") Integer zoneNo);

    /**
     * 进行结算
     * 添加结算金额可用金额、结算总金额
     *
     * @param supplierId
     * @param settledAmount
     * @param zoneNo
     * @return
     */
    int addSettledAmount(@Param("supplierId") Long supplierId, @Param("settledAmount") Long settledAmount, @Param("zoneNo") Integer zoneNo);

    /**
     * 根据供应商id求结算金额总和
     * @param supplierId
     * @return
     */
    Long getSettleAmountBySupplierId(@Param("supplierId") Long supplierId);

    /**
     * 根据供应商id获取分片之后钱包加和的信息
     * @param supplierId
     * @return
     */
    SupplierWalletVO getSupplierWalletByZone(@Param("supplierId") Long supplierId);
}
